<template>
	<view class="content" :style="{height: windowHeight + 'px'}">
		<image class="background" src="/static/cloth.jpg"></image>
		<view class="button-box">
			<view class="button">进入</view>
			<view class="button" @click="login">登录</view>
		</view>
		<uni-popup ref="popup" type="center">
			<view class="login-box">
				<view class="login-title">
					<view :class="{active:currentTabIndex == 0}" @click="tabClick(0)">已授权登录</view>
					<view :class="{active:currentTabIndex == 1}" @click="tabClick(1)">临时码登录</view>
				</view>
				<view>
					<block v-if="currentTabIndex == 0">
						<view class="loing-button" @click="authLogin">已授权用户一键登录</view>
					</block>
					<block v-if="currentTabIndex == 1">
						<input class="input" focus placeholder="请输入临时码" />
						<view class="loing-button" @click="codeLogin">确定登录</view>
					</block>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	const app = getApp()
	export default {
		data() {
			return {
				title: 'Hello',
				windowHeight: app.globalData.windowHeight,
				currentTabIndex: 0
			}
		},
		onLoad() {

		},
		methods: {
			login() {
				this.$refs.popup.open()
			},
			tabClick(index) {
				this.currentTabIndex = index
			},
			authLogin() {
				uni.navigateTo({
					url:"/pages/product/list"
				})
			}
		}
	}
</script>

<style>
	.content {
		width: 100%;
		position: relative;
	}

	.background {
		width: 100%;
		height: 100%;
	}

	.button-box {
		position: absolute;
		width: 100%;
		left: 0;
		right: 0;
		bottom: 400rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.button {
		text-align: center;
		width: 140rpx;
		height: 60rpx;
		line-height: 60rpx;
		font-size: 24rpx;
		padding: 20rpx 60prx;
		color: #fff;
		border: 2rpx solid #fff;
		margin-bottom: 20rpx;
	}

	.login-box {
		width: 750rpx;
		height: 600rpx;
		background-color: #f8f5f8;
		display: flex;
		flex-direction: column;
		align-items: center;
		color: #999;
	}
	.login-title{
		margin-top: 100rpx;
		width: 400rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-around;
	}
	.active{
		color: chocolate;
	}
	.input{
		width: 400rpx;
		margin: 100rpx auto;
		border-bottom: 1rpx solid #e9e9e9;
		padding: 6rpx;
	}

	.loing-button {
		text-align: center;
		width: 360rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 28rpx;
		padding: 20rpx 60prx;
		color: #fff;
		border: 2rpx solid #fff;
		border-radius: 40rpx;
		margin-bottom: 20rpx;
		background-color: chocolate;
		color: #fff;
		margin-top: 200rpx;
	}

	.common-login {
		font-size: 24rpx;
		margin-top: 100rpx;
	}
</style>